package com.hope.photoviewer.adapter;

import android.support.annotation.LayoutRes;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hope.photoviewer.DensityUtil;
import com.hope.photoviewer.ImageInfo;
import com.hope.photoviewer.R;

/**
 * @author xwAnd
 * @date 2018/3/19
 */

public class ImageListAdapter extends BaseQuickAdapter<ImageInfo, BaseViewHolder> {

    public ImageListAdapter(@LayoutRes int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, ImageInfo item) {
        ImageView imageView = helper.getView(R.id.image);
        imageView.setLayoutParams(new LinearLayout.LayoutParams(DensityUtil.getScreenWidth(mContext) / 3, DensityUtil.getScreenWidth(mContext) / 3));
        Glide.with(mContext).load(item.getBigImageUrl()).into((ImageView) helper.getView(R.id.image));
    }
}
